/**
* \file TCPServerSocket.h
* \brief TCPServerSocket decleration class
* \author Edouard ROGE
* \date 12 Novembre 2013
*/
#ifndef _TCPSERVERSOCKET_
#define _TCPSERVERSOCKET_

#include "Network.h"
#include "Core/Network/ITCPServerSocket.h"
#include "Core/Memory/HeapObject.h"

class TCPServerSocket : public Core::Network::ITCPServerSocket, public Core::Memory::HeapObject
{
public:

	/**
	 * \fn TCPServerSocket();
	 * \brief Default contructor
	 */
	TCPServerSocket();

	/**
	 * \fn virtual ~TCPServerSocket();
	 * \brief Destructor
	 */
	virtual ~TCPServerSocket();

	/**
	 * \fn virtual void Bind(uint32 _iPort);
	 * \param _iPort port to bind the socket
	 * \brief Bind socket
	 */
	NETWORK_WIN32 virtual void Bind(uint32 _iPort);

	/**
	 * \fn virtual ITCPSocket * AcceptConnection();
	 * \return a TCP socket to this connection
	 * \brief Accept a connection
	 */
	NETWORK_WIN32 virtual Core::Network::ITCPSocket * AcceptConnection();

	/**
	* \fn virtual void Close();
	* \brief Close socket
	*/
	NETWORK_WIN32 virtual void Close();

	/**
	* \fn virtual void Send(void * _pBuffer, uint32 _iSize);
	* \brief Send data through the socket
	*/
	NETWORK_WIN32 virtual void Send(void * _pBuffer, uint32 _iSize);

	/**
	* \fn virtual void Receive(void * _pBuffer, uint32 _iSize);
	* \brief Receive data through the socket
	*/
	NETWORK_WIN32 virtual void Receive(void * _pBuffer, uint32 _iSize);

	/**
	* \fn void Connect();
	* \brief Connect to another socket
	*/
	NETWORK_WIN32 virtual void Connect(const std::string & _strAddress, uint32 _iPort);

private:

	/** Socket descriptor, we use the socket features through it */
	int32 m_iDescriptor;
};


#endif // _TCPSERVERSOCKET_
